package com.wxzz.elearing.comment.api.admin;

import com.alibaba.fastjson.JSONObject;
import com.wxzz.elearing.comment.dto.ImproveCommentDto;
import com.wxzz.elearing.comment.entity.ImproveComment;
import com.wxzz.elearing.comment.service.IImproveCommentService;
import com.wxzz.elearning.common.exception.ServiceException;
import com.wxzz.elearning.common.vo.JgPageVo;
import com.wxzz.elearning.common.vo.ReturnVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/improve-comment")
@Api(tags = "改善问答类接口(后台)")
public class ImproveCommentController {

    @Autowired
    private IImproveCommentService iImproveCommentService;

    @Autowired
    private RedisTemplate<String, String> redisTemplate;


    @ApiOperation(value = "根据改善id列出所有评论(后台)", notes = "根据改善id列出所有评论(后台)", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "listComment", method = RequestMethod.POST)
    public ReturnVO<JgPageVo<List<ImproveComment>>> listComment(@RequestBody ImproveCommentDto skillCommentDto) {
        return iImproveCommentService.listComment(skillCommentDto);
    }


    @ApiOperation(value = "根据改善id删除评论(后台)", notes = "根据改善id删除评论(后台)", httpMethod = "POST", tags = "后台")
    @RequestMapping(value = "deleteComment/{uid}", method = RequestMethod.POST)
    public ReturnVO deleteComment(@PathVariable String uid) {
        return iImproveCommentService.deleteComment(uid);
    }
}
